<template>
	<view class="news">
		<news-item :list="newsList" @itemClick="goDetail"></news-item>
	</view>
</template>

<script>
	import newsItem from '../../components/news_item/news_item.vue'
	export default {
		components: {
			newsItem
		},
		data() {
			return {
				newsList: []
			}
		},
		onLoad() {
			this.getNews()
		},
		methods: {
			async getNews() {
				const res = await this.$myRequest({
					url: '/api/getnewslist'
				})
				this.newsList = res.data.message
			},

			goDetail(id) {
				uni.navigateTo({
					url: "/pages/news_detail/news_detail?id=" + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.news {}
</style>
